module RegisterFile #(ADDR_WIDTH = 5, DATA_WIDTH = 64) (
  input clk,
  input [DATA_WIDTH-1:0] wdata,
  input [ADDR_WIDTH-1:0] waddr,
  input [ADDR_WIDTH-1:0] raddra,
  input [ADDR_WIDTH-1:0] raddrb,
  input wen,
  output wire [DATA_WIDTH-1:0] rdata,
  output wire [DATA_WIDTH-1:0] rdatab
);
	reg [DATA_WIDTH-1:0] rf [2**ADDR_WIDTH-1:0];
	always @(posedge clk) begin
		if (wen) rf[waddr] <= wdata;
		rf[0] <=64'b0;
	end
	assign rdata = (raddra == 0) ? {DATA_WIDTH{1'b0}} : rf[raddra];
	assign rdatab = (raddrb == 0) ? {DATA_WIDTH{1'b0}} : rf[raddrb];

import "DPI-C" function void set_gpr_ptr(input logic [63:0] a []);
initial set_gpr_ptr(rf);  // rf为通用寄存器的二维数组变量
endmodule
